<!DOCTYPE html>
<html>
		<head>
			<meta charset="UTF-8">
			<meta charset="utf-8">
			<meta http-equiv="X-UA-Compatible" content="IE=edge">
			<meta name="viewport" content="width=device-width, initial-scale=1">
			<title>添加管理员信息</title>
			<link rel="shortcut icon" href="assets/ico/favicon.ico" type="image/x-icon" />
			<link href="assets/css/bootstrap.min.css" rel="stylesheet">
			<link href="assets/css/jquery.mmenu.css" rel="stylesheet">
			<link href="assets/css/font-awesome.min.css" rel="stylesheet">
			<link href="assets/plugins/jquery-ui/css/jquery-ui-1.10.4.min.css" rel="stylesheet">
			<link href="assets/plugins/chosen/css/chosen.css" rel="stylesheet">
			<link href="assets/css/style.min.css" rel="stylesheet">
			<link href="assets/css/add-ons.min.css" rel="stylesheet">
		</head>
	<body>

		<div class="row">
			<div class="col-md-6">
				<div class="panel panel-default">
					<div class="panel-heading">
						<h2><i class="fa fa-indent red"></i><strong>添加管理员信息</strong></h2>
					</div>
					<div class="panel-body">
						<form action="/addadmin" method="post" >

							<div class="form-group">
								<label class="col-md-3 control-label" for="text-input">用户名：</label>
								<div class="col-md-9">
									<input type="text" id="text" name="adminname" class="form-control" placeholder="请输入用户名：">
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-3 control-label" for="email-input">邮箱：</label>
								<div class="col-md-9">
									<input type="email" id="email-input" name="adminemali" class="form-control" placeholder="请输入邮箱：">
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-3 control-label" >密码：</label>
								<div class="col-md-9">
									<input type="password"  name="adminpwd" class="form-control" placeholder="请输入密码：">
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-3 control-label" >确认密码：</label>
								<div class="col-md-9">
									<input type="password"  name="adminpwd1" class="form-control" placeholder="确认密码：">
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-3 control-label" for="text-input">联系电话：</label>
								<div class="col-md-9">
									<input type="text" id="text-input" name="adminphone" class="form-control" placeholder="请输入联系电话：">
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-3 control-label" for="select">权限</label>
								<div class="col-md-9">
									<select id="select" name="adminauthority" class="form-control" size="1">
										<option >请选择权限</option>
										<option value="ADMIN">ADMIN</option>
										<option value="USER">USER</option>
										<option value="ANONYMOUS">ANONYMOUS</option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-3 control-label" for="textarea-input">家庭地址：</label>
								<div class="col-md-9">
									<textarea id="textarea-input" name="adminaddress" rows="6" class="form-control" placeholder="请输入家庭地址："></textarea>
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-3 control-label">状态</label>
								<div class="col-md-9">
									<div class="radio">
										<label for="radio1">
											<input type="radio" id="radio1" name="status" value="0" checked="checked"> 未注销
										</label>
									</div>
								</div>
							</div>
							<div >
								<button type="submit" class="btn btn-sm btn-success"><i class="fa fa-dot-circle-o"></i> 添加</button>
								<button type="reset" class="btn btn-sm btn-danger"><i class="fa fa-ban"></i> 重置</button>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</body>
		<script src="assets/js/jquery-1.4.1.js"></script>
		<script type="text/javascript">
            $(function(){
                $("input[name=adminname]").bind("blur",function(){
                    //清空
                    $(this).nextAll("span").remove();
                    var Emali=$(this).val();
                    if(Emali==null){
                        //如果不通过就给出提示
                        $("input[name=adminname]").after("<span>用户名不能为空</span>");
                    }
                });

                $("input[name=adminemali]").bind("blur",function(){
                    //清空
                    $(this).nextAll("span").remove();
                    var Emali=$(this).val();
                    if(Emali==null){
                        //如果不通过就给出提示
                        $("input[name=adminemali]").after("<span>邮箱不能为空</span>");
                    }
                });

                //要求验证密码至少是8位数，必须输入字母数字或者下划线
                //先得到密码框给密码框绑定离开事件
                $("input[name=adminpwd]").bind("blur",function(){
                    //清空
                    $(this).nextAll("span").remove();
                    //得到当前密码框的值
                    var pwd1Val=$(this).val();
                    //对密码进行验证
                    if(pwd1Val.length<8){
                        //如果不通过就给出提示
                        $("input[name=adminpwd]").after("<span>密码不能小于8为数</span>");
                    }
                });
                //验证两次密码是否一致
                $("input[name=adminpwd1]").bind("blur",function(){
                    //清空
                    $(this).nextAll("span").remove();
                    //得到当前密码框的值
                    var pwd2Val=$(this).val();
                    var pwd1val=$("input[name=adminpwd]").val();
                    //对密码进行验证
                    if(pwd2Val!=pwd1val){
                        //如果不通过就给出提示
                        $("input[name=adminpwd1]").after("<span>两次密码不正确</span>");
                    }
                });

                $("input[name=adminphone]").bind("blur",function(){
                    //清空
                    $(this).nextAll("span").remove();
                    var Phone=$(this).val();
                    if(Phone==null){
                        //如果不通过就给出提示
                        $("input[name=adminphone]").after("<span>联系电话不能为空</span>");
                    }
                });

                //验证地址
                $("input[name=adminaddress]").bind("blur",function(){
                    //清空
                    $(this).nextAll("span").remove();
                    var address=$(this).val();
                    if(address==null){
                        //如果不通过就给出提示
                        $("input[name=adminaddress]").after("<span>地址不能为空</span>");
                    }
                });

                //绑定提交事件
                $("form").bind("submit",function(){
                    //让form表单默认执行blur()方法
                    $("form").trigger("blur");
                    //如果span标签有值就表示有错误信息不能提交表单
                    if($("span").length>0){
                        return false;
                    }
                });
            });
		</script>
</html>
